#pragma once
#ifndef PACKETS_H
#define PACKETS_H

#include <HardwareSerial.h>
#include <Arduino.h>

#define DEVICE_CONFIGURATION_STATUS 0x20
#define DATA_MESSAGE                0x21
#define INITIALISATION_REQUEST      0xF0
#define DISCONNECT_REQUEST          0xF1
#define MESSAGE_ACK                 0xFF

#define PACKET_START				0x01
#define PACKET_END					0x04

#define SDID_ELYCRA 	0xA0
#define SDID_THERMISTOR 0xA1
#define SDID_FORCE 		0xA2
#define SDID_GPS 		0xA3
#define SDID_ACCX 		0xA4
#define SDID_ACCY 		0xA5
#define SDID_ACCZ 		0xA6
#define SDID_MMG 		0xA7
#define SDID_PULSE 		0xA8
#define SDID_FLEX 		0xA9

#define DFID_UINT8  0xB0
#define DFID_UINT16 0xB1
#define DFID_UINT32 0xB2
#define DFID_STRING 0xB3

typedef struct{
  unsigned char StartPacket;
  unsigned char MessageType;
  unsigned short DataLength;
  char* DataContent;
  unsigned short DataChecksum;
  unsigned char EndPacket;
} 
Packet;

void sendPacket(Packet* packet);
unsigned short calculateChecksum(Packet* packet);
void updateChecksum(Packet* packet);
int readPacket(Packet* packet);

#endif

